From 169fccc1684c52566c52d8bdb3549d919ae43a0b Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 16 Jul 2012 19:56:00 -0700
Subject: Don't use IN_FLOAT() when calling fabs() since it may clobber errno.

The emacs build shouldn't fail sometimes with an "Arithmetic error:".

Previously Emacs assumed that fabs() would not modify errno
unless there was an error, but that isn't guaranteed since fabs()
has no error conditions.

Origin: upstream, commit: 8e0e7a92f5ae99ce2461fc0f0b606d4cec3efb81
Added-by: Rob Browning <rlb@defaultvalue.org>
Provided-By: Paul Eggert  <eggert@cs.ucla.edu>
Bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11913
---
 src/ChangeLog  |    6 ++++++
 src/floatfns.c |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 45d9cea..a0fa940 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -64,6 +64,12 @@
 	(Fdelete_other_windows_internal): Signal an error if the window is
 	on a dead frame (Bug#11984).
 
+2012-07-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* floatfns.c (Fabs): Do not wrap fabs inside IN_FLOAT (Bug#11913).
+	Unlike the other wrapped functions, fabs has an unspecified
+	effect on errno.
+
 2012-07-14  Eli Zaretskii  <eliz@gnu.org>
 
 	Remove FILE_SYSTEM_CASE.
diff --git a/src/floatfns.c b/src/floatfns.c
index 305c78c..fa672c7 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -676,7 +676,7 @@ DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
   CHECK_NUMBER_OR_FLOAT (arg);
 
   if (FLOATP (arg))
-    IN_FLOAT (arg = make_float (fabs (XFLOAT_DATA (arg))), "abs", arg);
+    arg = make_float (fabs (XFLOAT_DATA (arg)));
   else if (XINT (arg) < 0)
     XSETINT (arg, - XINT (arg));
 
